<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>Google Picker Example</title>
	<script type="text/javascript">

      // The API developer key obtained from the Google APIs Console.
      var developerKey = 'AIzaSyBvKic9ZNUxTbey0jE0fn0uA_pOm_XIQNk';

      // Use the API Loader script to load google.picker.

      function loadPicker() {
        google.load("picker", "1", {"callback": createPicker});
      }


      // Create and render a Picker object for searching images.
      function createPicker() {
        var picker = new google.picker.PickerBuilder().
			enableFeature(google.picker.Feature.MULTISELECT_ENABLED).
            addView(new google.picker.DocsView().
				setParent("0B1rCbOxa4YbGYmYwN2NkYzYtMTJmMy00ZmU4LTllOGUtOGViNTRlNzBhNTNm").
				setIncludeFolders(true)).
			addView(new google.picker.DocsUploadView().
				setParent("0B1rCbOxa4YbGYmYwN2NkYzYtMTJmMy00ZmU4LTllOGUtOGViNTRlNzBhNTNm")).
			setLocale('zh-TW').
			setAuthUser('cmu.edu.tw').
            setDeveloperKey(developerKey).
            setCallback(pickerCallback).
            build();
        picker.setVisible(true);
      }

      // A simple callback implementation.
      function pickerCallback(data) {
        var url = 'nothing';
        if (data[google.picker.Response.ACTION] == google.picker.Action.PICKED) {
          var doc = data[google.picker.Response.DOCUMENTS][0];
          url = doc[google.picker.Document.URL];
        }
        var message = 'You picked: ' + url;
        alert(message);
      }



	  </script>
  </head>
  <body>
    <div id="result"></div>
	
    <!-- The Google API Loader script. -->
     <script type="text/javascript" src="http://www.google.com/jsapi"></script>
	 <button onclick="loadPicker()">Click me</button>
  </body>
</html>